home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / demos / OpenGL / ideas / draw_lamp.c < prev    next >
C/C++ Source or Header  |  1996-11-11  |  28KB  |  827 lines

  1. /*
  2.  * (c) Copyright 1993, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  36.  */
  37. #include <GL/gl.h>
  38.  
  39. #include "objects.h"
  40. /*
  41. #define glNormal3fv(v)  \
  42. { \
  43.   printf("%g, %g, %g --> %.10f\n", \
  44.      v[0], v[1], v[2], v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); \
  45.   glNormal3fv(v); \
  46. }
  47. */
  48. float hp[6][13][3] = {
  49.  
  50.     {
  51.     {0.000000, 0.000000, 1.000000},
  52.     {0.000000, 0.000000, 1.000000},
  53.     {0.000000, 0.000000, 1.000000},
  54.     {0.000000, 0.000000, 1.000000},
  55.     {0.000000, 0.000000, 1.000000},
  56.     {0.000000, 0.000000, 1.000000},
  57.     {0.000000, 0.000000, 1.000000},
  58.     {0.000000, 0.000000, 1.000000},
  59.     {0.000000, 0.000000, 1.000000},
  60.     {0.000000, 0.000000, 1.000000},
  61.     {0.000000, 0.000000, 1.000000},
  62.     {0.000000, 0.000000, 1.000000},
  63.     {0.000000, 0.000000, 1.000000},
  64.     },
  65.     {
  66.     {0.438371, 0.000000, 0.898794},
  67.     {0.379641, 0.219186, 0.898794},
  68.     {0.219186, 0.379641, 0.898794},
  69.     {0.000000, 0.438371, 0.898794},
  70.     {-0.219186, 0.379641, 0.898794},
  71.     {-0.379641, 0.219186, 0.898794},
  72.     {-0.438371, 0.000000, 0.898794},
  73.     {-0.379641, -0.219186, 0.898794},
  74.     {-0.219186, -0.379641, 0.898794},
  75.     {0.000000, -0.438371, 0.898794},
  76.     {0.219186, -0.379641, 0.898794},
  77.     {0.379641, -0.219186, 0.898794},
  78.     {0.438371, 0.000000, 0.898794},
  79.     },
  80.     {
  81.     {0.788011, 0.000000, 0.615662},
  82.     {0.682437, 0.394005, 0.615662},
  83.     {0.394005, 0.682437, 0.615662},
  84.     {0.000000, 0.788011, 0.615662},
  85.     {-0.394005, 0.682437, 0.615662},
  86.     {-0.682437, 0.394005, 0.615662},
  87.     {-0.788011, 0.000000, 0.615662},
  88.     {-0.682437, -0.394005, 0.615662},
  89.     {-0.394005, -0.682437, 0.615662},
  90.     {0.000000, -0.788011, 0.615662},
  91.     {0.394005, -0.682437, 0.615662},
  92.     {0.682437, -0.394005, 0.615662},
  93.     {0.788011, 0.000000, 0.615662},
  94.     },
  95.     {
  96.     {0.978148, 0.000000, 0.207912},
  97.     {0.847101, 0.489074, 0.207912},
  98.     {0.489074, 0.847101, 0.207912},
  99.     {0.000000, 0.978148, 0.207912},
  100.     {-0.489074, 0.847101, 0.207912},
  101.     {-0.847101, 0.489074, 0.207912},
  102.     {-0.978148, 0.000000, 0.207912},
  103.     {-0.847101, -0.489074, 0.207912},
  104.     {-0.489074, -0.847101, 0.207912},
  105.     {0.000000, -0.978148, 0.207912},
  106.     {0.489074, -0.847101, 0.207912},
  107.     {0.847101, -0.489074, 0.207912},
  108.     {0.978148, 0.000000, 0.207912},
  109.     },
  110.     {
  111.     {0.970296, 0.000000, -0.241922},
  112.     {0.840301, 0.485148, -0.241922},
  113.     {0.485148, 0.840301, -0.241922},
  114.     {0.000000, 0.970296, -0.241922},
  115.     {-0.485148, 0.840301, -0.241922},
  116.     {-0.840301, 0.485148, -0.241922},
  117.     {-0.970296, 0.000000, -0.241922},
  118.     {-0.840301, -0.485148, -0.241922},
  119.     {-0.485148, -0.840301, -0.241922},
  120.     {0.000000, -0.970296, -0.241922},
  121.     {0.485148, -0.840301, -0.241922},
  122.     {0.840301, -0.485148, -0.241922},
  123.     {0.970296, 0.000000, -0.241922},
  124.     },
  125.     {
  126.     {0.766044, 0.000000, -0.642788},
  127.     {0.663414, 0.383022, -0.642788},
  128.     {0.383022, 0.663414, -0.642788},
  129.     {0.000000, 0.766044, -0.642788},
  130.     {-0.383022, 0.663414, -0.642788},
  131.     {-0.663414, 0.383022, -0.642788},
  132.     {-0.766044, 0.000000, -0.642788},
  133.     {-0.663414, -0.383022, -0.642788},
  134.     {-0.383022, -0.663414, -0.642788},
  135.     {0.000000, -0.766044, -0.642788},
  136.     {0.383022, -0.663414, -0.642788},
  137.     {0.663414, -0.383022, -0.642788},
  138.     {0.766044, 0.000000, -0.642788},
  139.     },
  140. };
  141.  
  142. float ltp[9][25][3] = {
  143.      {
  144.     {10.000000, 0.000000, 1.000000},
  145.     {9.659258, -2.588191, 1.000000},
  146.     {8.660254, -5.000000, 1.000000},
  147.     {7.071068, -7.071068, 1.000000},
  148.     {5.000000, -8.660254, 1.000000},
  149.     {2.588191, -9.659258, 1.000000},
  150.     {0.000000, -10.000000, 1.000000},
  151.     {-2.588191, -9.659258, 1.000000},
  152.     {-5.000000, -8.660254, 1.000000},
  153.     {-7.071068, -7.071068, 1.000000},
  154.     {-8.660254, -5.000000, 1.000000},
  155.     {-9.659258, -2.588191, 1.000000},
  156.     {-10.000000, 0.000000, 1.000000},
  157.     {-9.659258, 2.588191, 1.000000},
  158.     {-8.660254, 5.000000, 1.000000},
  159.     {-7.071068, 7.071068, 1.000000},
  160.     {-5.000000, 8.660254, 1.000000},
  161.     {-2.588191, 9.659258, 1.000000},
  162.     {0.000000, 10.000000, 1.000000},
  163.     {2.588191, 9.659258, 1.000000},
  164.     {5.000000, 8.660254, 1.000000},
  165.     {7.071068, 7.071068, 1.000000},
  166.     {8.660254, 5.000000, 1.000000},
  167.     {9.659258, 2.588191, 1.000000},
  168.     {10.000000, 0.000000, 1.000000},
  169.     },
  170.  
  171.      {
  172.     {10.707107, 0.000000, 0.707107},
  173.     {10.342271, -2.771203, 0.707107},
  174.     {9.272627, -5.353553, 0.707107},
  175.     {7.571068, -7.571068, 0.707107},
  176.     {5.353553, -9.272627, 0.707107},
  177.     {2.771203, -10.342271, 0.707107},
  178.     {0.000000, -10.707107, 0.707107},
  179.     {-2.771203, -10.342271, 0.707107},
  180.     {-5.353553, -9.272627, 0.707107},
  181.     {-7.571068, -7.571068, 0.707107},
  182.     {-9.272627, -5.353553, 0.707107},
  183.     {-10.342271, -2.771203, 0.707107},
  184.     {-10.707107, 0.000000, 0.707107},
  185.     {-10.342271, 2.771203, 0.707107},
  186.     {-9.272627, 5.353553, 0.707107},
  187.     {-7.571068, 7.571068, 0.707107},
  188.     {-5.353553, 9.272627, 0.707107},
  189.     {-2.771203, 10.342271, 0.707107},
  190.     {0.000000, 10.707107, 0.707107},
  191.     {2.771203, 10.342271, 0.707107},
  192.     {5.353553, 9.272627, 0.707107},
  193.     {7.571068, 7.571068, 0.707107},
  194.     {9.272627, 5.353553, 0.707107},
  195.     {10.342271, 2.771203, 0.707107},
  196.     {10.707107, 0.000000, 0.707107},
  197.     },
  198.  
  199.      {
  200.     {11.000000, 0.000000, 0.000000},
  201.     {10.625184, -2.847009, 0.000000},
  202.     {9.526279, -5.500000, 0.000000},
  203.     {7.778174, -7.778174, 0.000000},
  204.     {5.500000, -9.526279, 0.000000},
  205.     {2.847009, -10.625184, 0.000000},
  206.     {0.000000, -11.000000, 0.000000},
  207.     {-2.847009, -10.625184, 0.000000},
  208.     {-5.500000, -9.526279, 0.000000},
  209.     {-7.778174, -7.778174, 0.000000},
  210.     {-9.526279, -5.500000, 0.000000},
  211.     {-10.625184, -2.847009, 0.000000},
  212.     {-11.000000, 0.000000, 0.000000},
  213.     {-10.625184, 2.847009, 0.000000},
  214.     {-9.526279, 5.500000, 0.000000},
  215.     {-7.778174, 7.778174, 0.000000},
  216.     {-5.500000, 9.526279, 0.000000},
  217.     {-2.847009, 10.625184, 0.000000},
  218.     {0.000000, 11.000000, 0.000000},
  219.     {2.847009, 10.625184, 0.000000},
  220.     {5.500000, 9.526279, 0.000000},
  221.     {7.778174, 7.778174, 0.000000},
  222.     {9.526279, 5.500000, 0.000000},
  223.     {10.625184, 2.847009, 0.000000},
  224.     {11.000000, 0.000000, 0.000000},
  225.     },
  226.  
  227.      {
  228.     {10.707107, 0.000000, -0.707107},
  229.     {10.342271, -2.771203, -0.707107},
  230.     {9.272627, -5.353553, -0.707107},
  231.     {7.571068, -7.571068, -0.707107},
  232.     {5.353553, -9.272627, -0.707107},
  233.     {2.771203, -10.342271, -0.707107},
  234.     {0.000000, -10.707107, -0.707107},
  235.     {-2.771203, -10.342271, -0.707107},
  236.     {-5.353553, -9.272627, -0.707107},
  237.     {-7.571068, -7.571068, -0.707107},
  238.     {-9.272627, -5.353553, -0.707107},
  239.     {-10.342271, -2.771203, -0.707107},
  240.     {-10.707107, 0.000000, -0.707107},
  241.     {-10.342271, 2.771203, -0.707107},
  242.     {-9.272627, 5.353553, -0.707107},
  243.     {-7.571068, 7.571068, -0.707107},
  244.     {-5.353553, 9.272627, -0.707107},
  245.     {-2.771203, 10.342271, -0.707107},
  246.     {0.000000, 10.707107, -0.707107},
  247.     {2.771203, 10.342271, -0.707107},
  248.     {5.353553, 9.272627, -0.707107},
  249.     {7.571068, 7.571068, -0.707107},
  250.     {9.272627, 5.353553, -0.707107},
  251.     {10.342271, 2.771203, -0.707107},
  252.     {10.707107, 0.000000, -0.707107},
  253.     },
  254.  
  255.      {
  256.     {10.000000, 0.000000, -1.000000},
  257.     {9.659258, -2.588191, -1.000000},
  258.     {8.660254, -5.000000, -1.000000},
  259.     {7.071068, -7.071068, -1.000000},
  260.     {5.000000, -8.660254, -1.000000},
  261.     {2.588191, -9.659258, -1.000000},
  262.     {0.000000, -10.000000, -1.000000},
  263.     {-2.588191, -9.659258, -1.000000},
  264.     {-5.000000, -8.660254, -1.000000},
  265.     {-7.071068, -7.071068, -1.000000},
  266.     {-8.660254, -5.000000, -1.000000},
  267.     {-9.659258, -2.588191, -1.000000},
  268.     {-10.000000, 0.000000, -1.000000},
  269.     {-9.659258, 2.588191, -1.000000},
  270.     {-8.660254, 5.000000, -1.000000},
  271.     {-7.071068, 7.071068, -1.000000},
  272.     {-5.000000, 8.660254, -1.000000},
  273.     {-2.588191, 9.659258, -1.000000},
  274.     {0.000000, 10.000000, -1.000000},
  275.     {2.588191, 9.659258, -1.000000},
  276.     {5.000000, 8.660254, -1.000000},
  277.     {7.071068, 7.071068, -1.000000},
  278.     {8.660254, 5.000000, -1.000000},
  279.     {9.659258, 2.588191, -1.000000},
  280.     {10.000000, 0.000000, -1.000000},
  281.     },
  282.  
  283.      {
  284.     {9.292893, 0.000000, -0.707107},
  285.     {8.976246, -2.405178, -0.707107},
  286.     {8.047881, -4.646447, -0.707107},
  287.     {6.571068, -6.571068, -0.707107},
  288.     {4.646447, -8.047881, -0.707107},
  289.     {2.405178, -8.976246, -0.707107},
  290.     {0.000000, -9.292893, -0.707107},
  291.     {-2.405178, -8.976246, -0.707107},
  292.     {-4.646447, -8.047881, -0.707107},
  293.     {-6.571068, -6.571068, -0.707107},
  294.     {-8.047881, -4.646447, -0.707107},
  295.     {-8.976246, -2.405178, -0.707107},
  296.     {-9.292893, 0.000000, -0.707107},
  297.     {-8.976246, 2.405178, -0.707107},
  298.     {-8.047881, 4.646447, -0.707107},
  299.     {-6.571068, 6.571068, -0.707107},
  300.     {-4.646447, 8.047881, -0.707107},
  301.     {-2.405178, 8.976246, -0.707107},
  302.     {0.000000, 9.292893, -0.707107},
  303.     {2.405178, 8.976246, -0.707107},
  304.     {4.646447, 8.047881, -0.707107},
  305.     {6.571068, 6.571068, -0.707107},
  306.     {8.047881, 4.646447, -0.707107},
  307.     {8.976246, 2.405178, -0.707107},
  308.     {9.292893, 0.000000, -0.707107},
  309.     },
  310.  
  311.      {
  312.     {9.000000, 0.000000, 0.000000},
  313.     {8.693333, -2.329371, 0.000000},
  314.     {7.794229, -4.500000, 0.000000},
  315.     {6.363961, -6.363961, 0.000000},
  316.     {4.500000, -7.794229, 0.000000},
  317.     {2.329371, -8.693333, 0.000000},
  318.     {0.000000, -9.000000, 0.000000},
  319.     {-2.329371, -8.693333, 0.000000},
  320.     {-4.500000, -7.794229, 0.000000},
  321.     {-6.363961, -6.363961, 0.000000},
  322.     {-7.794229, -4.500000, 0.000000},
  323.     {-8.693333, -2.329371, 0.000000},
  324.     {-9.000000, 0.000000, 0.000000},
  325.     {-8.693333, 2.329371, 0.000000},
  326.     {-7.794229, 4.500000, 0.000000},
  327.     {-6.363961, 6.363961, 0.000000},
  328.     {-4.500000, 7.794229, 0.000000},
  329.     {-2.329371, 8.693333, 0.000000},
  330.     {0.000000, 9.000000, 0.000000},
  331.     {2.329371, 8.693333, 0.000000},
  332.     {4.500000, 7.794229, 0.000000},
  333.     {6.363961, 6.363961, 0.000000},
  334.     {7.794229, 4.500000, 0.000000},
  335.     {8.693333, 2.329371, 0.000000},
  336.     {9.000000, 0.000000, 0.000000},
  337.     },
  338.  
  339.      {
  340.     {9.292893, 0.000000, 0.707107},
  341.     {8.976246, -2.405178, 0.707107},
  342.     {8.047881, -4.646447, 0.707107},
  343.     {6.571068, -6.571068, 0.707107},
  344.     {4.646447, -8.047881, 0.707107},
  345.     {2.405178, -8.976246, 0.707107},
  346.     {0.000000, -9.292893, 0.707107},
  347.     {-2.405178, -8.976246, 0.707107},
  348.     {-4.646447, -8.047881, 0.707107},
  349.     {-6.571068, -6.571068, 0.707107},
  350.     {-8.047881, -4.646447, 0.707107},
  351.     {-8.976246, -2.405178, 0.707107},
  352.     {-9.292893, 0.000000, 0.707107},
  353.     {-8.976246, 2.405178, 0.707107},
  354.     {-8.047881, 4.646447, 0.707107},
  355.     {-6.571068, 6.571068, 0.707107},
  356.     {-4.646447, 8.047881, 0.707107},
  357.     {-2.405178, 8.976246, 0.707107},
  358.     {0.000000, 9.292893, 0.707107},
  359.     {2.405178, 8.976246, 0.707107},
  360.     {4.646447, 8.047881, 0.707107},
  361.     {6.571068, 6.571068, 0.707107},
  362.     {8.047881, 4.646447, 0.707107},
  363.     {8.976246, 2.405178, 0.707107},
  364.     {9.292893, 0.000000, 0.707107},
  365.     },
  366.  
  367.      {
  368.     {10.000000, 0.000000, 1.000000},
  369.     {9.659258, -2.588191, 1.000000},
  370.     {8.660254, -5.000000, 1.000000},
  371.     {7.071068, -7.071068, 1.000000},
  372.     {5.000000, -8.660254, 1.000000},
  373.     {2.588191, -9.659258, 1.000000},
  374.     {0.000000, -10.000000, 1.000000},
  375.     {-2.588191, -9.659258, 1.000000},
  376.     {-5.000000, -8.660254, 1.000000},
  377.     {-7.071068, -7.071068, 1.000000},
  378.     {-8.660254, -5.000000, 1.000000},
  379.     {-9.659258, -2.588191, 1.000000},
  380.     {-10.000000, 0.000000, 1.000000},
  381.     {-9.659258, 2.588191, 1.000000},
  382.     {-8.660254, 5.000000, 1.000000},
  383.     {-7.071068, 7.071068, 1.000000},
  384.     {-5.000000, 8.660254, 1.000000},
  385.     {-2.588191, 9.659258, 1.000000},
  386.     {0.000000, 10.000000, 1.000000},
  387.     {2.588191, 9.659258, 1.000000},
  388.     {5.000000, 8.660254, 1.000000},
  389.     {7.071068, 7.071068, 1.000000},
  390.     {8.660254, 5.000000, 1.000000},
  391.     {9.659258, 2.588191, 1.000000},
  392.     {10.000000, 0.000000, 1.000000},
  393.     },
  394.  
  395. };
  396.  
  397. float ltn[9][25][3] = {
  398.     {
  399.     {0.000000, 0.000000, 1.000000},
  400.     {0.000000, 0.000000, 1.000000},
  401.     {0.000000, 0.000000, 1.000000},
  402.     {0.000000, 0.000000, 1.000000},
  403.     {0.000000, 0.000000, 1.000000},
  404.     {0.000000, 0.000000, 1.000000},
  405.     {0.000000, 0.000000, 1.000000},
  406.     {0.000000, 0.000000, 1.000000},
  407.     {0.000000, 0.000000, 1.000000},
  408.     {0.000000, 0.000000, 1.000000},
  409.     {0.000000, 0.000000, 1.000000},
  410.     {0.000000, 0.000000, 1.000000},
  411.     {0.000000, 0.000000, 1.000000},
  412.     {0.000000, 0.000000, 1.000000},
  413.     {0.000000, 0.000000, 1.000000},
  414.     {0.000000, 0.000000, 1.000000},
  415.     {0.000000, 0.000000, 1.000000},
  416.     {0.000000, 0.000000, 1.000000},
  417.     {0.000000, 0.000000, 1.000000},
  418.     {0.000000, 0.000000, 1.000000},
  419.     {0.000000, 0.000000, 1.000000},
  420.     {0.000000, 0.000000, 1.000000},
  421.     {0.000000, 0.000000, 1.000000},
  422.     {0.000000, 0.000000, 1.000000},
  423.     {0.000000, 0.000000, 1.000000},
  424.     },
  425.  
  426.     {
  427.     {0.707107, 0.000000, 0.707107},
  428.     {0.683013, -0.183013, 0.707107},
  429.     {0.612372, -0.353553, 0.707107},
  430.     {0.500000, -0.500000, 0.707107},
  431.     {0.353553, -0.612372, 0.707107},
  432.     {0.183013, -0.683013, 0.707107},
  433.     {0.000000, -0.707107, 0.707107},
  434.     {-0.183013, -0.683013, 0.707107},
  435.     {-0.353553, -0.612372, 0.707107},
  436.     {-0.500000, -0.500000, 0.707107},
  437.     {-0.612372, -0.353553, 0.707107},
  438.     {-0.683013, -0.183013, 0.707107},
  439.     {-0.707107, 0.000000, 0.707107},
  440.     {-0.683013, 0.183013, 0.707107},
  441.     {-0.612372, 0.353553, 0.707107},
  442.     {-0.500000, 0.500000, 0.707107},
  443.     {-0.353553, 0.612372, 0.707107},
  444.     {-0.183013, 0.683013, 0.707107},
  445.     {0.000000, 0.707107, 0.707107},
  446.     {0.183013, 0.683013, 0.707107},
  447.     {0.353553, 0.612372, 0.707107},
  448.     {0.500000, 0.500000, 0.707107},
  449.     {0.612372, 0.353553, 0.707107},
  450.     {0.683013, 0.183013, 0.707107},
  451.     {0.707107, 0.000000, 0.707107},
  452.     },
  453.  
  454.     {
  455.     {1.000000, 0.000000, 0.000000},
  456.     {0.965926, -0.258819, 0.000000},
  457.     {0.866025, -0.500000, 0.000000},
  458.     {0.707107, -0.707107, 0.000000},
  459.     {0.500000, -0.866025, 0.000000},
  460.     {0.258819, -0.965926, 0.000000},
  461.     {0.000000, -1.000000, 0.000000},
  462.     {-0.258819, -0.965926, 0.000000},
  463.     {-0.500000, -0.866025, 0.000000},
  464.     {-0.707107, -0.707107, 0.000000},
  465.     {-0.866025, -0.500000, 0.000000},
  466.     {-0.965926, -0.258819, 0.000000},
  467.     {-1.000000, 0.000000, 0.000000},
  468.     {-0.965926, 0.258819, 0.000000},
  469.     {-0.866025, 0.500000, 0.000000},
  470.     {-0.707107, 0.707107, 0.000000},
  471.     {-0.500000, 0.866025, 0.000000},
  472.     {-0.258819, 0.965926, 0.000000},
  473.     {0.000000, 1.000000, 0.000000},
  474.     {0.258819, 0.965926, 0.000000},
  475.     {0.500000, 0.866025, 0.000000},
  476.     {0.707107, 0.707107, 0.000000},
  477.     {0.866025, 0.500000, 0.000000},
  478.     {0.965926, 0.258819, 0.000000},
  479.     {1.000000, 0.000000, 0.000000},
  480.     },
  481.  
  482.     {
  483.     {0.707107, 0.000000, -0.707107},
  484.     {0.683013, -0.183013, -0.707107},
  485.     {0.612372, -0.353553, -0.707107},
  486.     {0.500000, -0.500000, -0.707107},
  487.     {0.353553, -0.612372, -0.707107},
  488.     {0.183013, -0.683013, -0.707107},
  489.     {0.000000, -0.707107, -0.707107},
  490.     {-0.183013, -0.683013, -0.707107},
  491.     {-0.353553, -0.612372, -0.707107},
  492.     {-0.500000, -0.500000, -0.707107},
  493.     {-0.612372, -0.353553, -0.707107},
  494.     {-0.683013, -0.183013, -0.707107},
  495.     {-0.707107, 0.000000, -0.707107},
  496.     {-0.683013, 0.183013, -0.707107},
  497.     {-0.612372, 0.353553, -0.707107},
  498.     {-0.500000, 0.500000, -0.707107},
  499.     {-0.353553, 0.612372, -0.707107},
  500.     {-0.183013, 0.683013, -0.707107},
  501.     {0.000000, 0.707107, -0.707107},
  502.     {0.183013, 0.683013, -0.707107},
  503.     {0.353553, 0.612372, -0.707107},
  504.     {0.500000, 0.500000, -0.707107},
  505.     {0.612372, 0.353553, -0.707107},
  506.     {0.683013, 0.183013, -0.707107},
  507.     {0.707107, 0.000000, -0.707107},
  508.     },
  509.  
  510.     {
  511.     {0.000000, 0.000000, -1.000000},
  512.     {0.000000, 0.000000, -1.000000},
  513.     {0.000000, 0.000000, -1.000000},
  514.     {0.000000, 0.000000, -1.000000},
  515.     {0.000000, 0.000000, -1.000000},
  516.     {0.000000, 0.000000, -1.000000},
  517.     {0.000000, 0.000000, -1.000000},
  518.     {0.000000, 0.000000, -1.000000},
  519.     {0.000000, 0.000000, -1.000000},
  520.     {0.000000, 0.000000, -1.000000},
  521.     {0.000000, 0.000000, -1.000000},
  522.     {0.000000, 0.000000, -1.000000},
  523.     {0.000000, 0.000000, -1.000000},
  524.     {0.000000, 0.000000, -1.000000},
  525.     {0.000000, 0.000000, -1.000000},
  526.     {0.000000, 0.000000, -1.000000},
  527.     {0.000000, 0.000000, -1.000000},
  528.     {0.000000, 0.000000, -1.000000},
  529.     {0.000000, 0.000000, -1.000000},
  530.     {0.000000, 0.000000, -1.000000},
  531.     {0.000000, 0.000000, -1.000000},
  532.     {0.000000, 0.000000, -1.000000},
  533.     {0.000000, 0.000000, -1.000000},
  534.     {0.000000, 0.000000, -1.000000},
  535.     {0.000000, 0.000000, -1.000000},
  536.     },
  537.  
  538.     {
  539.     {-0.707107, 0.000000, -0.707107},
  540.     {-0.683013, 0.183013, -0.707107},
  541.     {-0.612372, 0.353553, -0.707107},
  542.     {-0.500000, 0.500000, -0.707107},
  543.     {-0.353553, 0.612372, -0.707107},
  544.     {-0.183013, 0.683013, -0.707107},
  545.     {0.000000, 0.707107, -0.707107},
  546.     {0.183013, 0.683013, -0.707107},
  547.     {0.353553, 0.612372, -0.707107},
  548.     {0.500000, 0.500000, -0.707107},
  549.     {0.612372, 0.353553, -0.707107},
  550.     {0.683013, 0.183013, -0.707107},
  551.     {0.707107, 0.000000, -0.707107},
  552.     {0.683013, -0.183013, -0.707107},
  553.     {0.612372, -0.353553, -0.707107},
  554.     {0.500000, -0.500000, -0.707107},
  555.     {0.353553, -0.612372, -0.707107},
  556.     {0.183013, -0.683013, -0.707107},
  557.     {0.000000, -0.707107, -0.707107},
  558.     {-0.183013, -0.683013, -0.707107},
  559.     {-0.353553, -0.612372, -0.707107},
  560.     {-0.500000, -0.500000, -0.707107},
  561.     {-0.612372, -0.353553, -0.707107},
  562.     {-0.683013, -0.183013, -0.707107},
  563.     {-0.707107, 0.000000, -0.707107},
  564.     },
  565.  
  566.     {
  567.     {-1.000000, 0.000000, 0.000000},
  568.     {-0.965926, 0.258819, 0.000000},
  569.     {-0.866025, 0.500000, 0.000000},
  570.     {-0.707107, 0.707107, 0.000000},
  571.     {-0.500000, 0.866025, 0.000000},
  572.     {-0.258819, 0.965926, 0.000000},
  573.     {0.000000, 1.000000, 0.000000},
  574.     {0.258819, 0.965926, 0.000000},
  575.     {0.500000, 0.866025, 0.000000},
  576.     {0.707107, 0.707107, 0.000000},
  577.     {0.866025, 0.500000, 0.000000},
  578.     {0.965926, 0.258819, 0.000000},
  579.     {1.000000, 0.000000, 0.000000},
  580.     {0.965926, -0.258819, 0.000000},
  581.     {0.866025, -0.500000, 0.000000},
  582.     {0.707107, -0.707107, 0.000000},
  583.     {0.500000, -0.866025, 0.000000},
  584.     {0.258819, -0.965926, 0.000000},
  585.     {0.000000, -1.000000, 0.000000},
  586.     {-0.258819, -0.965926, 0.000000},
  587.     {-0.500000, -0.866025, 0.000000},
  588.     {-0.707107, -0.707107, 0.000000},
  589.     {-0.866025, -0.500000, 0.000000},
  590.     {-0.965926, -0.258819, 0.000000},
  591.     {-1.000000, 0.000000, 0.000000},
  592.     },
  593.  
  594.     {
  595.     {-0.707107, 0.000000, 0.707107},
  596.     {-0.683013, 0.183013, 0.707107},
  597.     {-0.612372, 0.353553, 0.707107},
  598.     {-0.500000, 0.500000, 0.707107},
  599.     {-0.353553, 0.612372, 0.707107},
  600.     {-0.183013, 0.683013, 0.707107},
  601.     {0.000000, 0.707107, 0.707107},
  602.     {0.183013, 0.683013, 0.707107},
  603.     {0.353553, 0.612372, 0.707107},
  604.     {0.500000, 0.500000, 0.707107},
  605.     {0.612372, 0.353553, 0.707107},
  606.     {0.683013, 0.183013, 0.707107},
  607.     {0.707107, 0.000000, 0.707107},
  608.     {0.683013, -0.183013, 0.707107},
  609.     {0.612372, -0.353553, 0.707107},
  610.     {0.500000, -0.500000, 0.707107},
  611.     {0.353553, -0.612372, 0.707107},
  612.     {0.183013, -0.683013, 0.707107},
  613.     {0.000000, -0.707107, 0.707107},
  614.     {-0.183013, -0.683013, 0.707107},
  615.     {-0.353553, -0.612372, 0.707107},
  616.     {-0.500000, -0.500000, 0.707107},
  617.     {-0.612372, -0.353553, 0.707107},
  618.     {-0.683013, -0.183013, 0.707107},
  619.     {-0.707107, 0.000000, 0.707107},
  620.     },
  621.  
  622.     {
  623.     {0.000000, 0.000000, 1.000000},
  624.     {0.000000, 0.000000, 1.000000},
  625.     {0.000000, 0.000000, 1.000000},
  626.     {0.000000, 0.000000, 1.000000},
  627.     {0.000000, 0.000000, 1.000000},
  628.     {0.000000, 0.000000, 1.000000},
  629.     {0.000000, 0.000000, 1.000000},
  630.     {0.000000, 0.000000, 1.000000},
  631.     {0.000000, 0.000000, 1.000000},
  632.     {0.000000, 0.000000, 1.000000},
  633.     {0.000000, 0.000000, 1.000000},
  634.     {0.000000, 0.000000, 1.000000},
  635.     {0.000000, 0.000000, 1.000000},
  636.     {0.000000, 0.000000, 1.000000},
  637.     {0.000000, 0.000000, 1.000000},
  638.     {0.000000, 0.000000, 1.000000},
  639.     {0.000000, 0.000000, 1.000000},
  640.     {0.000000, 0.000000, 1.000000},
  641.     {0.000000, 0.000000, 1.000000},
  642.     {0.000000, 0.000000, 1.000000},
  643.     {0.000000, 0.000000, 1.000000},
  644.     {0.000000, 0.000000, 1.000000},
  645.     {0.000000, 0.000000, 1.000000},
  646.     {0.000000, 0.000000, 1.000000},
  647.     {0.000000, 0.000000, 1.000000},
  648.     },
  649.  
  650. };
  651.  
  652. void draw_hemisphere(void) {
  653.  
  654.   glCallList(MAT_HEMISPHERE);
  655.   glEnable(GL_LIGHTING);
  656.  
  657.   /* CF damn! */
  658.   /* glEnable(GL_NORMALIZE); */
  659.  
  660.     glBegin(GL_TRIANGLE_STRIP);
  661.         glNormal3fv(hp[0][0]); glVertex3fv(hp[0][0]);
  662.         glNormal3fv(hp[1][0]); glVertex3fv(hp[1][0]);
  663.         glNormal3fv(hp[0][1]); glVertex3fv(hp[0][1]);
  664.         glNormal3fv(hp[1][1]); glVertex3fv(hp[1][1]);
  665.         glNormal3fv(hp[0][2]); glVertex3fv(hp[0][2]);
  666.         glNormal3fv(hp[1][2]); glVertex3fv(hp[1][2]);
  667.         glNormal3fv(hp[0][3]); glVertex3fv(hp[0][3]);
  668.         glNormal3fv(hp[1][3]); glVertex3fv(hp[1][3]);
  669.         glNormal3fv(hp[0][4]); glVertex3fv(hp[0][4]);
  670.         glNormal3fv(hp[1][4]); glVertex3fv(hp[1][4]);
  671.         glNormal3fv(hp[0][5]); glVertex3fv(hp[0][5]);
  672.         glNormal3fv(hp[1][5]); glVertex3fv(hp[1][5]);
  673.         glNormal3fv(hp[0][6]); glVertex3fv(hp[0][6]);
  674.         glNormal3fv(hp[1][6]); glVertex3fv(hp[1][6]);
  675.         glNormal3fv(hp[0][7]); glVertex3fv(hp[0][7]);
  676.         glNormal3fv(hp[1][7]); glVertex3fv(hp[1][7]);
  677.         glNormal3fv(hp[0][8]); glVertex3fv(hp[0][8]);
  678.         glNormal3fv(hp[1][8]); glVertex3fv(hp[1][8]);
  679.         glNormal3fv(hp[0][9]); glVertex3fv(hp[0][9]);
  680.         glNormal3fv(hp[1][9]); glVertex3fv(hp[1][9]);
  681.         glNormal3fv(hp[0][10]); glVertex3fv(hp[0][10]);
  682.         glNormal3fv(hp[1][10]); glVertex3fv(hp[1][10]);
  683.         glNormal3fv(hp[0][11]); glVertex3fv(hp[0][11]);
  684.         glNormal3fv(hp[1][11]); glVertex3fv(hp[1][11]);
  685.         glNormal3fv(hp[0][12]); glVertex3fv(hp[0][12]);
  686.         glNormal3fv(hp[1][12]); glVertex3fv(hp[1][12]);
  687.     glEnd();
  688.  
  689.     glBegin(GL_TRIANGLE_STRIP);
  690.         glNormal3fv(hp[1][0]); glVertex3fv(hp[1][0]);
  691.         glNormal3fv(hp[2][0]); glVertex3fv(hp[2][0]);
  692.         glNormal3fv(hp[1][1]); glVertex3fv(hp[1][1]);
  693.         glNormal3fv(hp[2][1]); glVertex3fv(hp[2][1]);
  694.         glNormal3fv(hp[1][2]); glVertex3fv(hp[1][2]);
  695.         glNormal3fv(hp[2][2]); glVertex3fv(hp[2][2]);
  696.         glNormal3fv(hp[1][3]); glVertex3fv(hp[1][3]);
  697.         glNormal3fv(hp[2][3]); glVertex3fv(hp[2][3]);
  698.         glNormal3fv(hp[1][4]); glVertex3fv(hp[1][4]);
  699.         glNormal3fv(hp[2][4]); glVertex3fv(hp[2][4]);
  700.         glNormal3fv(hp[1][5]); glVertex3fv(hp[1][5]);
  701.         glNormal3fv(hp[2][5]); glVertex3fv(hp[2][5]);
  702.         glNormal3fv(hp[1][6]); glVertex3fv(hp[1][6]);
  703.         glNormal3fv(hp[2][6]); glVertex3fv(hp[2][6]);
  704.         glNormal3fv(hp[1][7]); glVertex3fv(hp[1][7]);
  705.         glNormal3fv(hp[2][7]); glVertex3fv(hp[2][7]);
  706.         glNormal3fv(hp[1][8]); glVertex3fv(hp[1][8]);
  707.         glNormal3fv(hp[2][8]); glVertex3fv(hp[2][8]);
  708.         glNormal3fv(hp[1][9]); glVertex3fv(hp[1][9]);
  709.         glNormal3fv(hp[2][9]); glVertex3fv(hp[2][9]);
  710.         glNormal3fv(hp[1][10]); glVertex3fv(hp[1][10]);
  711.         glNormal3fv(hp[2][10]); glVertex3fv(hp[2][10]);
  712.         glNormal3fv(hp[1][11]); glVertex3fv(hp[1][11]);
  713.         glNormal3fv(hp[2][11]); glVertex3fv(hp[2][11]);
  714.         glNormal3fv(hp[1][12]); glVertex3fv(hp[1][12]);
  715.         glNormal3fv(hp[2][12]); glVertex3fv(hp[2][12]);
  716.     glEnd();
  717.  
  718.     glBegin(GL_TRIANGLE_STRIP);
  719.         glNormal3fv(hp[2][0]); glVertex3fv(hp[2][0]);
  720.         glNormal3fv(hp[3][0]); glVertex3fv(hp[3][0]);
  721.         glNormal3fv(hp[2][1]); glVertex3fv(hp[2][1]);
  722.         glNormal3fv(hp[3][1]); glVertex3fv(hp[3][1]);
  723.         glNormal3fv(hp[2][2]); glVertex3fv(hp[2][2]);
  724.         glNormal3fv(hp[3][2]); glVertex3fv(hp[3][2]);
  725.         glNormal3fv(hp[2][3]); glVertex3fv(hp[2][3]);
  726.         glNormal3fv(hp[3][3]); glVertex3fv(hp[3][3]);
  727.         glNormal3fv(hp[2][4]); glVertex3fv(hp[2][4]);
  728.         glNormal3fv(hp[3][4]); glVertex3fv(hp[3][4]);
  729.         glNormal3fv(hp[2][5]); glVertex3fv(hp[2][5]);
  730.         glNormal3fv(hp[3][5]); glVertex3fv(hp[3][5]);
  731.         glNormal3fv(hp[2][6]); glVertex3fv(hp[2][6]);
  732.         glNormal3fv(hp[3][6]); glVertex3fv(hp[3][6]);
  733.         glNormal3fv(hp[2][7]); glVertex3fv(hp[2][7]);
  734.         glNormal3fv(hp[3][7]); glVertex3fv(hp[3][7]);
  735.         glNormal3fv(hp[2][8]); glVertex3fv(hp[2][8]);
  736.         glNormal3fv(hp[3][8]); glVertex3fv(hp[3][8]);
  737.         glNormal3fv(hp[2][9]); glVertex3fv(hp[2][9]);
  738.         glNormal3fv(hp[3][9]); glVertex3fv(hp[3][9]);
  739.         glNormal3fv(hp[2][10]); glVertex3fv(hp[2][10]);
  740.         glNormal3fv(hp[3][10]); glVertex3fv(hp[3][10]);
  741.         glNormal3fv(hp[2][11]); glVertex3fv(hp[2][11]);
  742.         glNormal3fv(hp[3][11]); glVertex3fv(hp[3][11]);
  743.         glNormal3fv(hp[2][12]); glVertex3fv(hp[2][12]);
  744.         glNormal3fv(hp[3][12]); glVertex3fv(hp[3][12]);
  745.     glEnd();
  746.  
  747.     glBegin(GL_TRIANGLE_STRIP);
  748.         glNormal3fv(hp[3][0]); glVertex3fv(hp[3][0]);
  749.         glNormal3fv(hp[4][0]); glVertex3fv(hp[4][0]);
  750.         glNormal3fv(hp[3][1]); glVertex3fv(hp[3][1]);
  751.         glNormal3fv(hp[4][1]); glVertex3fv(hp[4][1]);
  752.         glNormal3fv(hp[3][2]); glVertex3fv(hp[3][2]);
  753.         glNormal3fv(hp[4][2]); glVertex3fv(hp[4][2]);
  754.         glNormal3fv(hp[3][3]); glVertex3fv(hp[3][3]);
  755.         glNormal3fv(hp[4][3]); glVertex3fv(hp[4][3]);
  756.         glNormal3fv(hp[3][4]); glVertex3fv(hp[3][4]);
  757.         glNormal3fv(hp[4][4]); glVertex3fv(hp[4][4]);
  758.         glNormal3fv(hp[3][5]); glVertex3fv(hp[3][5]);
  759.         glNormal3fv(hp[4][5]); glVertex3fv(hp[4][5]);
  760.         glNormal3fv(hp[3][6]); glVertex3fv(hp[3][6]);
  761.         glNormal3fv(hp[4][6]); glVertex3fv(hp[4][6]);
  762.         glNormal3fv(hp[3][7]); glVertex3fv(hp[3][7]);
  763.         glNormal3fv(hp[4][7]); glVertex3fv(hp[4][7]);
  764.         glNormal3fv(hp[3][8]); glVertex3fv(hp[3][8]);
  765.         glNormal3fv(hp[4][8]); glVertex3fv(hp[4][8]);
  766.         glNormal3fv(hp[3][9]); glVertex3fv(hp[3][9]);
  767.         glNormal3fv(hp[4][9]); glVertex3fv(hp[4][9]);
  768.         glNormal3fv(hp[3][10]); glVertex3fv(hp[3][10]);
  769.         glNormal3fv(hp[4][10]); glVertex3fv(hp[4][10]);
  770.         glNormal3fv(hp[3][11]); glVertex3fv(hp[3][11]);
  771.         glNormal3fv(hp[4][11]); glVertex3fv(hp[4][11]);
  772.         glNormal3fv(hp[3][12]); glVertex3fv(hp[3][12]);
  773.         glNormal3fv(hp[4][12]); glVertex3fv(hp[4][12]);
  774.     glEnd();
  775.  
  776.     glBegin(GL_TRIANGLE_STRIP);
  777.         glNormal3fv(hp[4][0]); glVertex3fv(hp[4][0]);
  778.         glNormal3fv(hp[5][0]); glVertex3fv(hp[5][0]);
  779.         glNormal3fv(hp[4][1]); glVertex3fv(hp[4][1]);
  780.         glNormal3fv(hp[5][1]); glVertex3fv(hp[5][1]);
  781.         glNormal3fv(hp[4][2]); glVertex3fv(hp[4][2]);
  782.         glNormal3fv(hp[5][2]); glVertex3fv(hp[5][2]);
  783.         glNormal3fv(hp[4][3]); glVertex3fv(hp[4][3]);
  784.         glNormal3fv(hp[5][3]); glVertex3fv(hp[5][3]);
  785.         glNormal3fv(hp[4][4]); glVertex3fv(hp[4][4]);
  786.         glNormal3fv(hp[5][4]); glVertex3fv(hp[5][4]);
  787.         glNormal3fv(hp[4][5]); glVertex3fv(hp[4][5]);
  788.         glNormal3fv(hp[5][5]); glVertex3fv(hp[5][5]);
  789.         glNormal3fv(hp[4][6]); glVertex3fv(hp[4][6]);
  790.         glNormal3fv(hp[5][6]); glVertex3fv(hp[5][6]);
  791.         glNormal3fv(hp[4][7]); glVertex3fv(hp[4][7]);
  792.         glNormal3fv(hp[5][7]); glVertex3fv(hp[5][7]);
  793.         glNormal3fv(hp[4][8]); glVertex3fv(hp[4][8]);
  794.         glNormal3fv(hp[5][8]); glVertex3fv(hp[5][8]);
  795.         glNormal3fv(hp[4][9]); glVertex3fv(hp[4][9]);
  796.         glNormal3fv(hp[5][9]); glVertex3fv(hp[5][9]);
  797.         glNormal3fv(hp[4][10]); glVertex3fv(hp[4][10]);
  798.         glNormal3fv(hp[5][10]); glVertex3fv(hp[5][10]);
  799.         glNormal3fv(hp[4][11]); glVertex3fv(hp[4][11]);
  800.         glNormal3fv(hp[5][11]); glVertex3fv(hp[5][11]);
  801.         glNormal3fv(hp[4][12]); glVertex3fv(hp[4][12]);
  802.         glNormal3fv(hp[5][12]); glVertex3fv(hp[5][12]);
  803.     glEnd();
  804.  
  805.   glDisable(GL_LIGHTING);
  806.   glColor3ub(255,  255,  255);
  807.   glBegin(GL_POLYGON);
  808.   glVertex3fv(hp[5][0]);
  809.   glVertex3fv(hp[5][1]);
  810.   glVertex3fv(hp[5][2]);
  811.   glVertex3fv(hp[5][3]);
  812.   glVertex3fv(hp[5][4]);
  813.   glVertex3fv(hp[5][5]);
  814.   glVertex3fv(hp[5][6]);
  815.   glVertex3fv(hp[5][7]);
  816.   glVertex3fv(hp[5][8]);
  817.   glVertex3fv(hp[5][9]);
  818.   glVertex3fv(hp[5][10]);
  819.   glVertex3fv(hp[5][11]);
  820.   glEnd();
  821.  
  822.   /* CF damn! */
  823.   /* glDisable(GL_NORMALIZE); */
  824.  
  825. }
  826.  
  827.